<?php
class WidgetController extends Zend_Controller_Action {
    public function itemnewsAction() {
        $this->front = Zend_Controller_Front::getInstance ();
        $this->view->setHelperPath ( './application/views/helpers', 'My_View_Helper' );
        $id = $this->_getParam ( 'id' );
        if ($id == '') {
            $id = $this->_getParam ( 'where' );
        }
        //echo $id;
        $db = Zend_Registry::get ( 'db' );
        $select = $db->select ();
        $select->from ( 'bc_news', array ('id', 'news_title', 'pic', 'news_content' ) );
        $select->order ( 'pic desc' );
        $select->order ( 'news_view' );
        $select->order ( 'id desc' );
        $select->where ( 'section_id = ?', $id );
        $select->where ( 'mode = ?', '1' );
        $select->limitPage ( 0, 11 );
        $sql = $select->__toString ();
        //Zend_Debug::dump($sql);
        $this->view->itemNews = $db->fetchAll ( $sql );
    }
    public function flashAction() {
        //		$front = Zend_Controller_Front::getInstance ();
        //		$front->setParam ( 'noViewRenderer', true );
        $pic = new Pic ( );
        $select = $pic->select ();
        $select->order ( 'order DESC' );
        $select->order ( 'id DESC' );
        $select->limitPage ( 1, 5 );
        $this->view->rows = $rows = $pic->fetchAll ( $select );
        Zend_Debug::dump ( $rows, 'rows', false );
    }
}
